
import { Dispatch } from "redux";
import { _login , _get_person} from "../api";

export const get_person_action = (params:object) => {
    return async (dispatch:Dispatch) => {
        const { data } = await _get_person(params);
        if(data.code){
            dispatch({
                type:"ADD_USER_LIST",
                payload:data
            })
        }
    }
}

export const login_action = (params:object) => {
    return async (dispatch:Dispatch) => {
        const { data } = await _login(params);
        if(data.code){
            alert(data.msg);
            dispatch({
                type:"SAVE_ROUTES",
                payload:data
            })
        }
    }
}



export const change_user = (key:string,value:string) => {
    return {
        type:"CHNAGE_USER",
        payload:{
            key,
            value
        }
    }
}













